# -*- coding: utf-8 -*-            
# @Author : chenliang
# @Time : 2024/3/19 14:26
import time
from Case.python_ui.Common.basepage import Basepage
from Case.python_ui.PageLocate.admin_data_storage_subscription_locator import AdminDataStorageLocator
from Case.python_ui.PageLocate.admin_operation_management_locator import AdminOperationManagementLocator
from Case.python_ui.Test_data.menu_name_data import MenuName
import re
from Case.python_ui.Common.excel import excel
from Case.python_ui.Test_data.login_data import Logindata
from Case.python_ui.PageLocate.admin_ticket_management_locator import AdminTicketManagementLocator
from Case.python_ui.Common.business_common_tool import BusinessCommonTools
from selenium.common.exceptions import NoSuchElementException
from selenium import webdriver
from datetime import datetime


class AdminOperationManagement(Basepage):
    """
           公共方法
    """

    # 判断一个列表中的所有值是否与给定的字符串完全一致
    def all_equal_to_string(self, lst, string):
        return all(elem == string for elem in lst)

    # 时间格式01-03-2024 15:37:00 转化为 2024-03-01
    def convert_date_format(self, date_str):
        # 将输入的时间字符串解析为 datetime 对象
        date_obj = datetime.strptime(date_str, "%d-%m-%Y %H:%M:%S")
        # 将 datetime 对象转换为所需的日期格式字符串
        new_date_str = date_obj.strftime("%Y-%m-%d")
        return new_date_str

    """
        operation management / Resource Compare Query
    """

    # 等待页面加载转动
    def wait_web_page_rotate(self, time=100):
        doc = '等待页面加载转动图标'
        try:
            self.wait_elevisble(AdminDataStorageLocator.wait, doc, time)
            self.wait_eleinvisble(AdminDataStorageLocator.wait, doc, time)
        except:
            pass

    # 进入operation management | Resource Compare Query页面
    def enter_resource_compare_query(self):
        doc = '进入operation management | Resource Compare Query页面'
        time.sleep(5)
        self.scroll_bar_operation(AdminOperationManagementLocator.operation_management_menu)
        try:
            text = self.get_attribute(AdminOperationManagementLocator.if_open_operation_management, 'Class', doc)
        except NoSuchElementException as e:
            text = 'antd4-menu antd4-menu-sub antd4-menu-inline antd4-menu-hidden'
        if text != 'antd4-menu antd4-menu-sub antd4-menu-inline':
            self.move_mouse_to_click_element(AdminOperationManagementLocator.operation_management_menu, doc)
        self.wait_elevisble(AdminOperationManagementLocator.resource_compare_query_menu, doc)
        self.move_mouse_to_click_element(AdminOperationManagementLocator.resource_compare_query_menu, doc)
        self.wait_web_page_rotate(time=10)
        self.wait_elevisble(AdminOperationManagementLocator.resource_compare_query_overview, doc)
        self.wait_elevisble(AdminOperationManagementLocator.resource_compare_query_log, doc)

    # 检查resource_compare_overview页面表格默认筛选Fail的数据
    def check_resource_compare_overview_result(self):
        doc = '检查resource_compare_overview tab页 result默认fail'
        time.sleep(2)
        self.move_mouse_to_click_element(AdminOperationManagementLocator.resource_compare_query_overview, doc)
        self.wait_elevisble(AdminOperationManagementLocator.button_result, doc)
        self.move_mouse_to_click_element(AdminOperationManagementLocator.button_result, doc)
        time.sleep(1)
        self.wait_elevisble(AdminOperationManagementLocator.result_list, doc)
        result_list = self.get_elements(AdminOperationManagementLocator.result_list, doc)
        # 判断只勾选了fail
        data_value = []
        for i in result_list:
            class_value = i.get_attribute("class")
            data_menu_id_value = i.get_attribute("data-menu-id")
            if 'menu-item-selected' in class_value:
                data_value.append(data_menu_id_value)
        text = '默认勾选的值:' + ','.join(data_value)
        assert len(data_value) == 1 and 'Failed' in data_value[0], text

    # 检查resource_compare_log页面表格默认筛选Fail的数据
    def check_resource_compare_log_result(self):
        doc = '检查resource_compare_log tab页 result默认fail'
        time.sleep(2)
        self.move_mouse_to_click_element(AdminOperationManagementLocator.resource_compare_query_log, doc)
        time.sleep(2)
        self.wait_elevisble(AdminOperationManagementLocator.button_result1, doc)
        self.move_mouse_to_click_element(AdminOperationManagementLocator.button_result1, doc)
        time.sleep(1)
        self.wait_elevisble(AdminOperationManagementLocator.result_list, doc)
        result_list = self.get_elements(AdminOperationManagementLocator.result_list, doc)
        # 判断只勾选了fail
        data_value = []
        for i in result_list:
            class_value = i.get_attribute("class")
            data_menu_id_value = i.get_attribute("data-menu-id")
            if 'menu-item-selected' in class_value:
                data_value.append(data_menu_id_value)
        text = '默认勾选的值:' + ','.join(data_value)
        assert len(data_value) == 1 and 'Failed' in data_value[0], text

    # 获取列表第一条数据的organization值
    def get_first_organization(self, tab):
        doc = '获取第一条数据的organization的值'
        time.sleep(2)
        try:
            self.wait_elevisble(AdminOperationManagementLocator.get_list_organization(tab), doc)
            organization = self.get_element(AdminOperationManagementLocator.get_list_organization(tab), doc).text
            return organization
        except:
            return 0

    # 获取列表第一条数据的instance值
    def get_first_instance(self, tab):
        doc = '获取第一条数据的instance的值'
        time.sleep(2)
        try:
            self.wait_elevisble(AdminOperationManagementLocator.get_list_instance_id(tab), doc)
            instance = self.get_element(AdminOperationManagementLocator.get_list_instance_id(tab), doc).text
            return instance
        except:
            return 0

    # 获取列表第一条数据的Event ID值
    def get_first_event_id(self):
        doc = '获取第一条数据的Event ID的值'
        time.sleep(2)
        try:
            self.wait_elevisble(AdminOperationManagementLocator.get_list_event_id, doc)
            event_id = self.get_element(AdminOperationManagementLocator.get_list_event_id, doc).text
            return event_id
        except:
            return 0

    # TL707515 | 搜索条件新增Organization
    def search_by_Organization(self, tab, org_tab, title):
        doc = '根据organization去查询'
        organization = self.get_first_organization(tab)
        if organization != 0:
            self.wait_elevisble(AdminOperationManagementLocator.get_click_input_search(tab), doc)
            self.move_mouse_to_click_element(AdminOperationManagementLocator.get_click_input_search(tab), doc)
            time.sleep(2)
            self.wait_elevisble(AdminOperationManagementLocator.get_search_list_by_title(org_tab, title), doc)
            self.move_mouse_to_click_element(AdminOperationManagementLocator.get_search_list_by_title(org_tab, title),
                                             doc)
            self.wait_elevisble(AdminOperationManagementLocator.search_input(tab), doc)
            self.send_keys(AdminOperationManagementLocator.search_input(tab), organization, doc)
            self.wait_elevisble(AdminOperationManagementLocator.button_search(tab), doc)
            self.click_element(AdminOperationManagementLocator.button_search(tab), doc)
            self.wait_web_page_rotate(2)
            organization_list = self.get_elements(AdminOperationManagementLocator.get_list_organization(tab, '2'), doc)
            organization_list_new = []
            for i in organization_list:
                organization_list_new.append(i.text)
            text = '预期值：' + organization + '实际值:' + ','.join(organization_list_new)
            assert self.all_equal_to_string(organization_list_new, organization), text

        else:
            text = '列表无数据'
            assert 1 == 2, text

    # instance id查询
    def search_by_instance(self, tab, org_tab, title):
        doc = "根据instance去查询"
        instance = self.get_first_instance(tab)
        if instance != 0:
            self.wait_elevisble(AdminOperationManagementLocator.get_click_input_search(tab), doc)
            self.move_mouse_to_click_element(AdminOperationManagementLocator.get_click_input_search(tab), doc)
            time.sleep(2)
            self.wait_elevisble(AdminOperationManagementLocator.get_search_list_by_title(org_tab, title), doc)
            self.move_mouse_to_click_element(AdminOperationManagementLocator.get_search_list_by_title(org_tab, title),
                                             doc)
            self.wait_elevisble(AdminOperationManagementLocator.search_input(tab), doc)
            self.send_keys(AdminOperationManagementLocator.search_input(tab), instance, doc)
            self.wait_elevisble(AdminOperationManagementLocator.button_search(tab), doc)
            self.click_element(AdminOperationManagementLocator.button_search(tab), doc)
            self.wait_web_page_rotate(5)
            instance_list = self.get_elements(AdminOperationManagementLocator.get_list_instance_id(tab, '2'), doc)
            instance_list_new = []
            for i in instance_list:
                instance_list_new.append(i.text)
            text = '预期值：' + instance + '实际值:' + ','.join(instance_list_new)
            assert self.all_equal_to_string(instance_list_new, instance), text

        else:
            text = '列表无数据'
            assert 1 == 2, text

    """还可扩展"""

    ##TL707242 | 界面优化
    def enter_events_detail(self):
        doc = '点击进入events_detail'
        first_event_id = self.get_first_event_id()
        if first_event_id != 0:
            self.move_mouse_to_click_element(AdminOperationManagementLocator.get_list_event_id, doc)
            self.wait_web_page_rotate(5)
            self.wait_elevisble(AdminOperationManagementLocator.event_information_id, doc)
            event_information_id = self.get_element(AdminOperationManagementLocator.event_information_id, doc).text
            text = 'event_id预期值:' + first_event_id + '实际值:' + event_information_id
            assert first_event_id == event_information_id, text
        else:
            text = '列表无数据'
            assert 1 == 2, text

    """
         operation management / Monitoring Events
    """

    def enter_monitoring_events(self):
        doc = '进入operation management | Monitoring Events页面'
        time.sleep(5)
        self.scroll_bar_operation(AdminOperationManagementLocator.operation_management_menu)
        try:
            text = self.get_attribute(AdminOperationManagementLocator.if_open_operation_management, 'Class', doc)
        except NoSuchElementException as e:
            text = 'antd4-menu antd4-menu-sub antd4-menu-inline antd4-menu-hidden'
        if text != 'antd4-menu antd4-menu-sub antd4-menu-inline':
            self.move_mouse_to_click_element(AdminOperationManagementLocator.operation_management_menu, doc)
        self.wait_elevisble(AdminOperationManagementLocator.monitoring_events_menu, doc)
        self.move_mouse_to_click_element(AdminOperationManagementLocator.monitoring_events_menu, doc)
        self.wait_web_page_rotate(time=5)
        try:
            self.wait_elevisble(AdminOperationManagementLocator.click_search_term, doc)
            self.wait_elevisble(AdminOperationManagementLocator.input_search_term, doc)
            self.wait_elevisble(AdminOperationManagementLocator.button_search1, doc)
            self.wait_elevisble(AdminOperationManagementLocator.button_reset, doc)
        except e as TimeoutError:
            text = '缺少查询条件'
            assert 1 == 2, text

    # 获取列表第一条数据的Event ID值
    def get_first_name(self):
        doc = '获取第一条数据的Event ID的值'
        time.sleep(2)
        try:
            self.wait_elevisble(AdminOperationManagementLocator.list_first_name, doc)
            first_name = self.get_element(AdminOperationManagementLocator.list_first_name, doc).text
            return first_name
        except:
            return 0

    # 进入monitoring_events_detail页面，数据项检查
    def check_monitoring_events_detail(self):
        doc = '进入monitoring_events_detail页面检查'
        first_name = self.get_first_name()
        if first_name != 0:
            list_data_checked = {}
            first_type = self.get_element(AdminOperationManagementLocator.list_first_type, doc).text
            monitor_from = self.get_element(AdminOperationManagementLocator.list_first_monitor_from, doc).text
            Notification = self.get_element(AdminOperationManagementLocator.list_first_Notification, doc).text
            list_data_checked['first_name'] = first_name
            list_data_checked['first_type'] = first_type
            list_data_checked['monitor_from'] = monitor_from
            list_data_checked['Notification'] = Notification
            self.move_mouse_to_click_element(AdminOperationManagementLocator.list_first_name, doc)
            self.wait_web_page_rotate(5)
            text = '存在详情页面字段值不一致'
            assert self.get_element(AdminOperationManagementLocator.detail_name, doc).text == list_data_checked[
                'first_name'], text
            assert self.get_element(AdminOperationManagementLocator.detail_type, doc).text == list_data_checked[
                'first_type'], text
            assert self.get_element(AdminOperationManagementLocator.detail_monitor_from, doc).text == list_data_checked[
                'monitor_from'], text
            assert self.get_element(AdminOperationManagementLocator.detail_Notification, doc).text == list_data_checked[
                'Notification'], text
        else:
            text = '列表无数据'
            assert 1 == 2, text

    def enter_check_Trouble_and_rules_detail(self):
        doc = '检查Trouble Shooting和Rules & Scenarios详情页'
        self.check_monitoring_events_detail()
        self.wait_elevisble(AdminOperationManagementLocator.button_trouble_shooting, doc)
        self.move_mouse_to_click_element(AdminOperationManagementLocator.button_trouble_shooting, doc)
        time.sleep(2)
        self.move_mouse_to_click_element(AdminOperationManagementLocator.button_close, doc)
        time.sleep(2)
        self.wait_elevisble(AdminOperationManagementLocator.button_rules, doc)
        self.move_mouse_to_click_element(AdminOperationManagementLocator.button_rules, doc)
        time.sleep(2)
        self.move_mouse_to_click_element(AdminOperationManagementLocator.button_close, doc)

    """
         operation management / Events
    """

    def enter_events(self):
        doc = '进入operation management | Events页面'
        time.sleep(5)
        self.scroll_bar_operation(AdminOperationManagementLocator.operation_management_menu)
        try:
            text = self.get_attribute(AdminOperationManagementLocator.if_open_operation_management, 'Class', doc)
        except NoSuchElementException as e:
            text = 'antd4-menu antd4-menu-sub antd4-menu-inline antd4-menu-hidden'
        if text != 'antd4-menu antd4-menu-sub antd4-menu-inline':
            self.move_mouse_to_click_element(AdminOperationManagementLocator.operation_management_menu, doc)
        self.wait_elevisble(AdminOperationManagementLocator.events_menu, doc)
        self.move_mouse_to_click_element(AdminOperationManagementLocator.events_menu, doc)
        self.wait_web_page_rotate(time=5)
        try:
            self.wait_elevisble(AdminOperationManagementLocator.click_events_search_term, doc)
            self.wait_elevisble(AdminOperationManagementLocator.input_events_search_term, doc)
            self.wait_elevisble(AdminOperationManagementLocator.button_events_search, doc)
            self.wait_elevisble(AdminOperationManagementLocator.button_events_reset, doc)
        except e as TimeoutError:
            text = '缺少查询条件'
            assert 1 == 2, text

    # 时间控件
    def time_control(self, date, hours, minutes, second):
        doc = '时间控件选择'
        time.sleep(2)
        choose_time_list = self.get_elements(AdminOperationManagementLocator.choose_time, doc)
        choose_hours_list = self.get_elements(AdminOperationManagementLocator.choose_hours_minutes('1'), doc)
        choose_minutes_list = self.get_elements(AdminOperationManagementLocator.choose_hours_minutes('2'), doc)
        choose_second_list = self.get_elements(AdminOperationManagementLocator.choose_hours_minutes('3'), doc)
        exit_flag = False
        for e in range(12):
            for i in choose_time_list:
                if i.get_attribute("title") == date:
                    i.click()
                    exit_flag = True
                    break
            if exit_flag:
                break
            else:
                self.wait_elevisble(AdminOperationManagementLocator.choose_begin_time, doc)
                self.move_mouse_to_click_element(AdminOperationManagementLocator.choose_begin_time, doc)
        time.sleep(5)
        for i in choose_hours_list:
            self.driver.execute_script("arguments[0].scrollIntoView({ block: 'center', inline: 'center' });", i)
            print('小时选中循环次数:', i.text)
            if i.text == hours:
                print('选中的小时:', i.text)
                i.click()
                break
        for i in choose_minutes_list:
            self.driver.execute_script("arguments[0].scrollIntoView({ block: 'center', inline: 'center' });", i)
            print('分钟选中循环次数:', i.text)
            if i.text == minutes:
                print('选中的分钟:', i.text)
                i.click()
                break
        for i in choose_second_list:
            self.driver.execute_script("arguments[0].scrollIntoView({ block: 'center', inline: 'center' });", i)
            print('秒选中循环次数:', i.text)
            if i.text == second:
                print('选中的秒:', i.text)
                i.click()
                break
        time.sleep(2)
        self.move_mouse_to_click_element(AdminOperationManagementLocator.button_ok_time, doc)
        time.sleep(2)

    # 根据时间进行查询
    def search_time(self, date, hours, minutes, second):
        doc = '根据时间进行查询'
        time.sleep(2)
        self.wait_elevisble(AdminOperationManagementLocator.click_time, doc)
        self.move_mouse_to_click_element(AdminOperationManagementLocator.click_time, doc)
        self.time_control(date, hours, minutes, second)
        self.time_control(date, hours, minutes, second)
        time.sleep(2)
        self.move_mouse_to_click_element(AdminOperationManagementLocator.button_events_search, doc)
        self.wait_web_page_rotate(10)

    # 获取列表第一条数据的Last Updated Time ，列表无值返回0
    def get_events_first_time(self):
        doc = '获取第一条数据的Last Updated Time的值'
        time.sleep(2)
        try:
            self.wait_elevisble(AdminOperationManagementLocator.events_first_time, doc)
            first_time = self.get_element(AdminOperationManagementLocator.events_first_time, doc).text
            return first_time
        except:
            return 0

    # 检查根据时间进行查询列表数据是否正确
    def check_search_time(self):
        doc = '检查根据时间进行查询,events列表数据是否正确'
        first_time = self.get_events_first_time()
        if first_time != 0:
            # 使用正则表达式模式对字符串进行拆分
            pattern = r"[-: ]"  # 模式横杠，冒号或空格出现一次或多次
            time_list = re.split(pattern, first_time)
            time.sleep(2)
            self.wait_elevisble(AdminOperationManagementLocator.click_time, doc)
            self.move_mouse_to_click_element(AdminOperationManagementLocator.click_time, doc)
            date = time_list[2] + '-' + time_list[1] + '-' + time_list[0]
            self.time_control(date, time_list[3], time_list[4], str(int(time_list[5]) - 1))
            self.time_control(date, time_list[3], time_list[4], str(int(time_list[5]) + 1))
            time.sleep(2)
            self.move_mouse_to_click_element(AdminOperationManagementLocator.button_events_search, doc)
            self.wait_web_page_rotate(10)
            events_time_list = self.get_elements(AdminOperationManagementLocator.events_time, doc)
            for i in events_time_list:
                text = '预期值: ' + first_time + '实际值: ' + i.text
                assert i.text == first_time, text
        else:
            text = 'events列表无数据'
            assert 1 == 2, text

    def check_last_updated_date(self):
        doc = '检查events页面时间倒叙'
        time.sleep(5)
        events_time_list = self.get_elements(AdminOperationManagementLocator.events_time, doc)
        time_strings = []
        for i in events_time_list:
            time_strings.append(i.text)
        # 将时间字符串转换为 datetime 对象
        time_objects = [datetime.strptime(time_str, "%d-%m-%Y %H:%M:%S") for time_str in time_strings]
        # 检查时间对象是否按降序排列
        is_descending = all(time_objects[i] >= time_objects[i + 1] for i in range(len(time_objects) - 1))
        text = ','.join(time_strings)
        print(text)
        assert is_descending, text

    # TL707200 | Events界面上半部分统计展示
    def check_events_num(self, tab):
        doc = 'events页面上面统计数量交验'
        time.sleep(2)
        if tab == 1:
            self.wait_elevisble(AdminOperationManagementLocator.sla_breach_num, doc)
            num = self.get_element(AdminOperationManagementLocator.sla_breach_num, doc).text
            self.move_mouse_to_click_element(AdminOperationManagementLocator.sla_breach_num, doc)
        if tab == 2:
            self.wait_elevisble(AdminOperationManagementLocator.new_num, doc)
            num = self.get_element(AdminOperationManagementLocator.new_num, doc).text
            self.move_mouse_to_click_element(AdminOperationManagementLocator.new_num, doc)
        if tab == 3:
            self.wait_elevisble(AdminOperationManagementLocator.re_open_num, doc)
            num = self.get_element(AdminOperationManagementLocator.re_open_num, doc).text
            self.move_mouse_to_click_element(AdminOperationManagementLocator.re_open_num, doc)
        if tab == 4:
            self.wait_elevisble(AdminOperationManagementLocator.manual_fix, doc)
            num = self.get_element(AdminOperationManagementLocator.manual_fix, doc).text
            self.move_mouse_to_click_element(AdminOperationManagementLocator.manual_fix, doc)
        if tab == 5:
            self.wait_elevisble(AdminOperationManagementLocator.ignored_num, doc)
            num = self.get_element(AdminOperationManagementLocator.ignored_num, doc).text
            self.move_mouse_to_click_element(AdminOperationManagementLocator.ignored_num, doc)
        self.wait_web_page_rotate(5)
        total_num = self.get_element(AdminOperationManagementLocator.total_num, doc).text
        # 使用正则表达式模式对字符串进行拆分
        pattern = r"[ ]"
        total_num_list = re.split(pattern, total_num)
        text = '预期值:' + num + '实际值:' + total_num_list[1]
        assert num <= total_num_list[1], text

    # 更新status状态，置空
    def update_export_status(self):
        doc = '更新events页面的status状态为空'
        time.sleep(4)
        self.wait_elevisble(AdminOperationManagementLocator.status_choose, doc)
        self.move_mouse_to_click_element(AdminOperationManagementLocator.status_choose, doc)
        time.sleep(3)
        self.wait_elevisble(AdminOperationManagementLocator.reset_point,doc)
        print('是否隐藏:',self.is_element_disabled(AdminOperationManagementLocator.reset_point))
        if self.is_element_disabled(AdminOperationManagementLocator.reset_point):
            self.move_mouse_to_click_element(AdminOperationManagementLocator.reset_point, doc)
            time.sleep(3)
            self.save_screen(doc)
            self.wait_elevisble(AdminOperationManagementLocator.ok_point, doc)
            self.move_mouse_to_click_element(AdminOperationManagementLocator.ok_point, doc)
        else:
            #self.move_mouse_to_click_element(AdminOperationManagementLocator.ok_point, doc)
            self.wait_elevisble(AdminOperationManagementLocator.ok_point, doc)
            self.move_mouse_to_click_element(AdminOperationManagementLocator.ok_point, doc)
        time.sleep(3)
        self.move_mouse_to_click_element(AdminOperationManagementLocator.button_events_search, doc)
        time.sleep(3)

    # 根据名称选择status状态
    def select_status_by_name(self, status_name):
        doc = '选择events页面的status状态'
        time.sleep(3)
        self.wait_elevisble(AdminOperationManagementLocator.status_choose, doc)
        self.move_mouse_to_click_element(AdminOperationManagementLocator.status_choose, doc)
        time.sleep(3)
        self.move_mouse_to_click_element(AdminOperationManagementLocator.select_status_by_name(status_name), doc)
        self.move_mouse_to_click_element(AdminOperationManagementLocator.ok_point, doc)
        time.sleep(5)
        self.move_mouse_to_click_element(AdminOperationManagementLocator.button_events_search, doc)
        time.sleep(5)

    # 创建一个events 事件
    def create_events_new(self, cmdopt, get_database_source):
        doc = ''
        time.sleep(5)
        BusinessCommonTools().update_job_info(cmdopt, get_database_source)
        time.sleep(10)
        self.update_export_status()
        time.sleep(5)

    # 查看new状态数据，没有就创建一个，没有返回0，有返回eventid
    def search_new_status(self):
        doc = '查询status=NEW状态的events'
        time.sleep(3)
        self.update_export_status()
        time.sleep(3)
        self.select_status_by_name('NEW')
        total_num = self.get_element(AdminOperationManagementLocator.total_num, doc).text
        # 使用正则表达式模式对字符串进行拆分
        pattern = r"[ ]"
        total_num_list = re.split(pattern, total_num)
        if int(total_num_list[1]) > 0:
            self.wait_elevisble(AdminOperationManagementLocator.first_event_id, doc)
            first_event_id = self.get_element(AdminOperationManagementLocator.first_event_id, doc).text
            first_status = self.get_element(AdminOperationManagementLocator.first_status, doc).text
            self.save_screen(doc)
            text = '预期值: NEW' + '实际值:' + first_status
            assert first_status == 'NEW', text
            return first_event_id
        else:
            text = '列表无NEW数据'
            assert 1 == 2, text

    # 根据event_id进行查询
    def search_by_event_id(self, event_id):
        doc = '根据event_id进行查询'
        self.update_export_status()
        self.wait_elevisble(AdminOperationManagementLocator.input_events_search_term, doc)
        self.send_keys(AdminOperationManagementLocator.input_events_search_term, event_id, doc)
        self.move_mouse_to_click_element(AdminOperationManagementLocator.button_events_search, doc)
        self.wait_web_page_rotate(10)

    # 查看operation_history组件的显示
    def check_status_history(self):
        doc = ''
        first_event_id = self.search_new_status()
        self.search_by_event_id(first_event_id)
        self.wait_elevisble(AdminOperationManagementLocator.first_event_id, doc)
        self.move_mouse_to_click_element(AdminOperationManagementLocator.first_event_id, doc)
        time.sleep(3)
        self.wait_elevisble(AdminOperationManagementLocator.event_history, doc)
        self.move_mouse_to_click_element(AdminOperationManagementLocator.event_history, doc)
        time.sleep(2)
        text_new_event_created = self.get_element(AdminOperationManagementLocator.text_new_event_created, doc).text
        text_new = self.get_element(AdminOperationManagementLocator.text_new, doc).text
        assert text_new_event_created == 'New Event Created' and text_new == 'NEW'
